<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>智学 - {% block title %}智能学习平台{% endblock %}</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet">
    <style>
        .navbar-brand {
            font-weight: bold;
            color: #007bff !important;
        }
        .main-content {
            min-height: calc(100vh - 150px);
            padding: 30px 0;
        }
        .footer {
            background-color: #f8f9fa;
            padding: 20px 0;
            border-top: 1px solid #e9ecef;
        }
    </style>
    {% block extra_css %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white">
    <div class="container">
        <a class="navbar-brand" href="{{ url_for('index') }}">智学</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav me-auto">
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('index') }}">首页</a>
                </li>
                {% if session.get('user_id') %}
                {% if session.get('role') == 'student' %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('student_dashboard') }}">控制面板</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('student_learning_paths') }}">学习路径</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('student_ai_qa') }}">智能问答</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('student_exercises') }}">练习</a>
                </li>
                {% else %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('teacher_dashboard') }}">控制面板</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('teacher_manage_students') }}">学生管理</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('teacher_courses') }}">课程管理</a>
                </li>
                {% endif %}
                {% endif %}
            </ul>
            <ul class="navbar-nav">
                {% if session.get('user_id') %}
                <li class="nav-item">
                    <span class="nav-link text-secondary"><i class="fas fa-user-circle me-1"></i>{{ session.get('username') }}</span>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('logout') }}"><i class="fas fa-sign-out-alt me-1"></i>登出</a>
                </li>
                {% else %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('login') }}"><i class="fas fa-sign-in-alt me-1"></i>登录/注册</a>
                </li>
                {% endif %}
            </ul>
        </div>
    </div>
</nav>

<div class="container main-content">
    {% with messages = get_flashed_messages(with_categories=true) %}
    {% if messages %}
    {% for category, message in messages %}
    <div class="alert alert-{{ category }} alert-dismissible fade show mt-3">
        {{ message }}
        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
    </div>
    {% endfor %}
    {% endif %}
    {% endwith %}

    {% block content %}{% endblock %}
</div>

<footer class="footer">
    <div class="container">
        <div class="row">
            <div class="col-md-12 text-center">
                <h5 class="text-primary">智学</h5>
                <p>基于多智能体的个性化学习平台</p>
                <p>&copy; {{ now.year }} 智学. 保留所有权利。</p>
            </div>
        </div>
    </div>
</footer>

<script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
{% block extra_js %}{% endblock %}
</body>
</html> 